﻿<%@ Page Language="C#" MasterPageFile="~/template.master" AutoEventWireup="true"
    CodeFile="reservations.aspx.cs" Inherits="SmartParking.Web.Reservations" Title="SmartParking >> Reservaciones" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>
<%@ Register Assembly="ADEVSO" Namespace="ADEVSO.Web.UI.WebControls" TagPrefix="ADEVSO" %>

<asp:Content ID="Content1" ContentPlaceHolderID="MainHead" runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContentPlaceHolder" runat="Server">
    <div class="template_container">
        <div class="template_container_top">
            <p>
                <img src="media/img/paso1.jpg" alt="" width="527" height="119"/>
            </p>
            <div class="template_container_top_left">
                <asp:Panel ID="panelParking" runat="server" CssClass="panel" Width="250px" GroupingText="Información del Parqueo">
                    <asp:UpdatePanel ID="upaParkingInfo" runat="server">
                        <ContentTemplate>
                            <asp:Label ID="lbPark" runat="server" Text="Parqueo:" Width="50px" />
                            <asp:DropDownList ID="ddlPark" runat="server" OnSelectedIndexChanged="ddlPark_SelectedIndexChanged"
                                AutoPostBack="true" Width="145px">
                            </asp:DropDownList>
                            <asp:Label ID="lbParkZone" runat="server" Text="Zona:" Width="50px" />
                            <asp:DropDownList ID="ddlParkZone" runat="server" OnSelectedIndexChanged="ddlParkZone_SelectedIndexChanged"
                                AutoPostBack="true" Width="145px">
                            </asp:DropDownList>
                            <asp:Label ID="lbPrice" runat="server" Text="Precio/Hora: [$XXX] + [$XXX] comisión" />
                        </ContentTemplate>
                    </asp:UpdatePanel>
                </asp:Panel>
            </div>
            <div class="template_container_top_right">
                <asp:Panel ID="panelReservation" runat="server" CssClass="panel" Width="280px" GroupingText="Información de Reservación">
                    <asp:UpdatePanel ID="upaReservationInfo" runat="server" ChildrenAsTriggers="true">
                        <ContentTemplate>
                            <asp:Label ID="lbDate" runat="server" Text="Fecha:" Width="35px" />
                            <asp:TextBox ID="tboxDate" runat="server" Width="60px" ReadOnly="false" Enabled="false"></asp:TextBox>
                            <asp:ImageButton ID="imgbtnDate" runat="server" ImageUrl="~/media/img/calendar.png" />
                            <ajaxToolkit:CalendarExtender ID="calDate" runat="server" TargetControlID="tboxDate"
                                EnableViewState="true" Format="dd/MM/yyyy" PopupButtonID="imgbtnDate" PopupPosition="Right">
                            </ajaxToolkit:CalendarExtender>
                            <asp:Label ID="lbStartHour" runat="server" Text="Entrada:" Width="40px" />
                            <asp:DropDownList ID="ddlStartHour" runat="server" Width="75px" OnSelectedIndexChanged="ddlStartHour_SelectedIndexChanged" AutoPostBack="true">
                            </asp:DropDownList>
                            <asp:Label ID="lbCar" runat="server" Text="Placa:" Width="35px" ToolTip="# Placa del Carro" />
                            <asp:TextBox ID="tboxCar" runat="server" Width="60px" ToolTip="# Placa del Carro"></asp:TextBox>
                            <ajaxToolkit:MaskedEditExtender ID="mskCar" runat="server" TargetControlID="tboxCar"
                                Mask="?{10}">
                            </ajaxToolkit:MaskedEditExtender>
                            <asp:Label ID="lbEndHour" runat="server" Text="Salida:" Width="40px" Style="margin-left: 20px" />
                            <asp:DropDownList ID="ddlEndHour" runat="server" Width="75px">
                            </asp:DropDownList>
                            <asp:ImageButton ID="imgbtnValidate" runat="server" AlternateText="Validar Disponibilidad"
                                ToolTip="Validar Disponibilidad" ImageUrl="" OnClick="imgbtnValidate_Click" Height="10px" />
                            <asp:ImageButton ID="imgbtnReserve" runat="server" AlternateText="Reservar"
                                ToolTip="Reservar" OnClick="imgbtnReserve_Click" Height="10px"/>
                        </ContentTemplate>
                    </asp:UpdatePanel>                    
                </asp:Panel>
            </div>
        </div>
        <div class="template_container_bottom">
            <asp:UpdatePanel ID="upaReservations" runat="server">
                <ContentTemplate>
                    <ADEVSO:GridView ID="grdReservations" runat="server" Width="535px" CaptionAlign="Top"
                        AutoGenerateColumns="False" ForeColor="#333333" OnBindingMethod="LoadReservations"
                        OnRowDataBound="grdReservations_RowDataBound" OnRowUpdating="grdReservations_RowUpdating"
                        ShowEmptyTable="true" EmptyTableRowText="No hay reservaciones realizadas hasta el momento."
                        Font-Size="10px">
                        <Columns>
                            <asp:TemplateField HeaderText="IdReservation" Visible="false">
                                <ItemTemplate>
                                    <asp:Label ID="lbIdReservation" runat="server" Text='<%# Bind("IdReservation") %>' />
                                </ItemTemplate>
                                <EditItemTemplate>
                                    <asp:Label ID="lbIdReservation" runat="server" Text='<%# Bind("IdReservation") %>' />
                                </EditItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Parqueo" HeaderStyle-HorizontalAlign="Center" HeaderStyle-Width="90px">
                                <ItemTemplate>
                                    <asp:Label ID="lbPark" runat="server" Text='<%# DisplayPark(Eval("IdParkZone")) %>' />
                                </ItemTemplate>
                                <EditItemTemplate>
                                    <asp:Label ID="lbPark" runat="server" Text='<%# DisplayPark(Eval("IdParkZone")) %>' />
                                </EditItemTemplate>
                                <ItemStyle HorizontalAlign="Center" />
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Zona" HeaderStyle-HorizontalAlign="Center" HeaderStyle-Width="100px">
                                <ItemTemplate>
                                    <asp:Label ID="lbParkZone" runat="server" Text='<%# DisplayParkZone(Eval("IdParkZone")) %>' />
                                </ItemTemplate>
                                <EditItemTemplate>
                                    <asp:Label ID="lbParkZone" runat="server" Text='<%# DisplayParkZone(Eval("IdParkZone")) %>' />
                                </EditItemTemplate>
                                <ItemStyle HorizontalAlign="Center" />
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="# Placa" HeaderStyle-HorizontalAlign="Center" HeaderStyle-Width="55px">
                                <ItemTemplate>
                                    <asp:Label ID="lbCar" runat="server" Text='<%# Bind("Car") %>' />
                                </ItemTemplate>
                                <EditItemTemplate>
                                    <asp:TextBox ID="tboxCar" runat="server" Text='<%# Bind("Car") %>' Width="40px" Font-Size="10px"/>
                                    <asp:RequiredFieldValidator ID="rfvCar" runat="server" ControlToValidate="tboxCar"
                                        ErrorMessage="El campo '# Placa' es requerido.">*</asp:RequiredFieldValidator>
                                </EditItemTemplate>
                                <ItemStyle HorizontalAlign="Center" />
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Día" HeaderStyle-HorizontalAlign="Center" HeaderStyle-Width="60px">
                                <ItemTemplate>
                                    <asp:Label ID="lbDay" runat="server" Text='<%# DisplayDay(Eval("StartDateTime")) %>' />
                                </ItemTemplate>
                                <EditItemTemplate>
                                    <asp:Label ID="lbDay" runat="server" Text='<%# DisplayDay(Eval("StartDateTime")) %>' />
                                </EditItemTemplate>
                                <ItemStyle HorizontalAlign="Center" />
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Entrada" HeaderStyle-HorizontalAlign="Center" HeaderStyle-Width="60px" >
                                <ItemTemplate>
                                    <asp:Label ID="lbStartHour" runat="server" Text='<%# DisplayHour(Eval("StartDateTime")) %>' />
                                </ItemTemplate>
                                <EditItemTemplate>
                                    <asp:Label ID="lbStartHour" runat="server" Text='<%# DisplayHour(Eval("StartDateTime")) %>' />
                                </EditItemTemplate>
                                <ItemStyle HorizontalAlign="Center" />
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Salida" HeaderStyle-HorizontalAlign="Center" HeaderStyle-Width="60px">
                                <ItemTemplate>
                                    <asp:Label ID="lbEndHour" runat="server" Text='<%# DisplayHour(Eval("EndDateTime")) %>' />
                                </ItemTemplate>
                                <EditItemTemplate>
                                    <asp:Label ID="lbEndHour" runat="server" Text='<%# DisplayHour(Eval("EndDateTime")) %>' />
                                </EditItemTemplate>
                                <ItemStyle HorizontalAlign="Center" />
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Monto" HeaderStyle-HorizontalAlign="Center" HeaderStyle-Width="55px">
                                <ItemTemplate>
                                    <asp:Label ID="lbTotalAmount" runat="server" Text='<%# DisplayAmount(Eval("TotalAmount")) %>' />
                                </ItemTemplate>
                                <EditItemTemplate>
                                    <asp:Label ID="lbTotalAmount" runat="server" Text='<%# DisplayAmount(Eval("TotalAmount")) %>' />
                                </EditItemTemplate>
                                <FooterTemplate>
                                    <asp:Label ID="lbTotalAmount" runat="server" Text='<%# DisplayTotalAmount() %>' />
                                </FooterTemplate>
                                <ItemStyle HorizontalAlign="Center" />
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Comisión" HeaderStyle-HorizontalAlign="Center" HeaderStyle-Width="55px">
                                <ItemTemplate>
                                    <asp:Label ID="lbTotalCommission" runat="server" Text='<%# DisplayCommission(Eval("TotalCommission")) %>' />
                                </ItemTemplate>
                                <EditItemTemplate>
                                    <asp:Label ID="lbTotalCommission" runat="server" Text='<%# DisplayCommission(Eval("TotalCommission")) %>' />
                                </EditItemTemplate>
                                <FooterTemplate>
                                    <asp:Label ID="lbTotalCommission" runat="server" Text='<%# DisplayTotalCommission() %>' />
                                </FooterTemplate>
                                <ItemStyle HorizontalAlign="Center" />
                            </asp:TemplateField>
                            <ADEVSO:CommandField ShowEditButton="True" EditImageUrl="" ShowDeleteButton="true" DeleteImageUrl="" />
                        </Columns>
                    </ADEVSO:GridView>
                    <asp:ValidationSummary ID="vsReservations" runat="server" />
                    <p class="links">
                        <%--<a id="cmdForward" runat="server" class="link-right" href="terms.aspx" visible="false"> Siguiente&gt;&gt;</a>--%>
                        <asp:HyperLink id="cmdForward" runat="server" CssClass="link-right" NavigateUrl="terms.aspx" Text="Siguiente &gt;&gt;"></asp:HyperLink>
                    </p>
                </ContentTemplate>
            </asp:UpdatePanel>            
        </div>
        <asp:UpdateProgress ID="uprParkingInfo" runat="server" AssociatedUpdatePanelID="upaParkingInfo">
            <ProgressTemplate>
                <div>
                    <asp:Image ID="Image2" runat="server" ImageUrl="~/media/img/progress.gif" />
                    <asp:Label ID="Label2" runat="server" Text="Please wait..." />
                </div>
            </ProgressTemplate>
        </asp:UpdateProgress>
        <asp:UpdateProgress ID="uprReservationInfo" runat="server" AssociatedUpdatePanelID="upaReservationInfo">
            <ProgressTemplate>
                <div>
                    <asp:Image ID="Image1" runat="server" ImageUrl="~/media/img/progress.gif" />
                    <asp:Label ID="Label1" runat="server" Text="Please wait..." />
                </div>
            </ProgressTemplate>
        </asp:UpdateProgress>
        <asp:UpdateProgress ID="uprParkings" runat="server" AssociatedUpdatePanelID="upaReservations">
            <ProgressTemplate>
                <div>
                    <asp:Image ID="Image3" runat="server" ImageUrl="~/media/img/progress.gif" />
                    <asp:Label ID="Label3" runat="server" Text="Please wait..." />
                </div>
            </ProgressTemplate>
        </asp:UpdateProgress>
    </div>
</asp:Content>
